<link rel="stylesheet" type="text/css" href="__STATIC__/admin_page/static/h-ui/css/H-ui.min.css"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/admin_page/static/h-ui.admin/css/H-ui.admin.css"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/admin_page/lib/Hui-iconfont/1.0.8/iconfont.css"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/admin_page/static/h-ui.admin/skin/default/skin.css" id="skin"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/admin_page/static/h-ui.admin/css/style.css"/>
<script type="text/javascript" src="/static/js/vue2.5.1.js"></script>
<script src="/static/js/axios.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin_page/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin_page/lib/layer/2.4/layer.js"></script>
<script src="/static/js/jquery.base64.js"></script>
<div class="page-container" id="password">
    <article class="cl pd-20">
        <form action="" method="post" class="form form-horizontal" id="form-member-add">
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>请输入类别名称：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" v-model="service_type_name" class="input-text" placeholder="请输入类别名称"
                           name="service_type_name">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>请输入类别名称(英文)：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="service_type_name_en" class="input-text" v-model="service_type_name_en"
                           placeholder="请输入类别名称(英文)"
                           name="text">
                </div>
            </div>
            <div class="row cl">
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                    <input class="btn btn-primary radius" @click="member_add" value="提交">
                </div>
            </div>
        </form>
    </article>
</div>

<script>
    new Vue({
        el: '#password',
        data: {
            service_type_name: '',
            service_type_name_en: '',
        },
        created() {

        },
        methods: {
            member_add: function () {
                if (this.service_type_name.length && this.service_type_name_en.length) {
                    axios.post('/admin/Servicetypes/add',
                        {
                            service_type_name: this.service_type_name,
                            service_type_name_en: this.service_type_name_en,
                            request_type: 'h5',
                        }
                    ).then(response => {
                        if (response.data.status == 200) {
                            this.service_type_name = '';
                            this.service_type_name_en = '';
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                            location.reload();
                        } else {
                            layer.alert(response.data.msg)
                        }
                    })
                } else {
                    layer.alert('服务商中英文必须填写');
                }

            }
        }
    });
</script>

